﻿using Microsoft.AspNetCore.SignalR;
using SignalR.Server.WebHubs;

namespace SignalR.Server.Hubs
{
    public class ManageHub : Hub<IManageHub>
    {
        private readonly ILogger<ManageHub> _logger;

        public ManageHub(ILogger<ManageHub> logger)
        {
            _logger = logger;
        }
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="msg"></param>
        public async Task SendMessage(string msg)
        {
            await Clients.All.SendMessage(msg);
        }

        public async Task RunFirstStep(string msg)
        {
           // await Clients.Caller.SendAsync("CallByHub", $"CallByClientWithReturn by {Context.ConnectionId} === {msg}"); //谁调的 返回去调谁
            _logger.LogInformation($"RunFirstStep==========={msg}");
            await Task.Delay(1000);
        }
    }
}
